<!DOCTYPE html>
<html lang="zh_cn">
<head>
        <title>来玩魔王的咚</title>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <meta charset="utf-8" />
        <!-- twitter card metadata -->
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="/images/mowang.png">
<meta name="twitter:site" content="">
<meta name="twitter:title" content="来玩魔王的咚">
<meta name="twitter:description" content="">
        <!-- OG Tags -->
<meta property="og:url" content=""/>
<meta property="og:title" content="来玩魔王的咚" />
<meta property="og:description" content="" />
        <!-- favicon -->
        <link rel="icon" type="image/png" href="/images/mowang.png">
        <!-- moment.js for date formatting -->
        <script src="/theme/js/moment.js"></script>
        <!-- css -->
        <link rel="stylesheet" type="text/css" href="/theme/css/main.css" />
        <!-- 左边的menu，如果页面高度不够，就跟着滚动，否则文章分类显示不全 -->
        <link rel="stylesheet" type="text/css" href="/theme/css/mycss/menu.css" />
		<script>
			
                /*! grunt-grunticon Stylesheet Loader - v2.1.2 | https://github.com/filamentgroup/grunticon | (c) 2015 Scott Jehl, Filament Group, Inc. | MIT license. */
    
    (function(e){function t(t,n,r,o){"use strict";function a(){for(var e,n=0;u.length>n;n++)u[n].href&&u[n].href.indexOf(t)>-1&&(e=!0);e?i.media=r||"all":setTimeout(a)}var i=e.document.createElement("link"),l=n||e.document.getElementsByTagName("script")[0],u=e.document.styleSheets;return i.rel="stylesheet",i.href=t,i.media="only x",i.onload=o||null,l.parentNode.insertBefore(i,l),a(),i}var n=function(r,o){"use strict";if(r&&3===r.length){var a=e.navigator,i=e.Image,l=!(!document.createElementNS||!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect||!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1")||e.opera&&-1===a.userAgent.indexOf("Chrome")||-1!==a.userAgent.indexOf("Series40")),u=new i;u.onerror=function(){n.method="png",n.href=r[2],t(r[2])},u.onload=function(){var e=1===u.width&&1===u.height,a=r[e&&l?0:e?1:2];n.method=e&&l?"svg":e?"datapng":"png",n.href=a,t(a,null,null,o)},u.src="",document.documentElement.className+=" grunticon"}};n.loadCSS=t,e.grunticon=n})(this);(function(e,t){"use strict";var n=t.document,r="grunticon:",o=function(e){if(n.attachEvent?"complete"===n.readyState:"loading"!==n.readyState)e();else{var t=!1;n.addEventListener("readystatechange",function(){t||(t=!0,e())},!1)}},a=function(e){return t.document.querySelector('link[href$="'+e+'"]')},c=function(e){var t,n,o,a,c,i,u={};if(t=e.sheet,!t)return u;n=t.cssRules?t.cssRules:t.rules;for(var l=0;n.length>l;l++)o=n[l].cssText,a=r+n[l].selectorText,c=o.split(");")[0].match(/US\-ASCII\,([^"']+)/),c&&c[1]&&(i=decodeURIComponent(c[1]),u[a]=i);return u},i=function(e){var t,o,a;o="data-grunticon-embed";for(var c in e)if(a=c.slice(r.length),t=n.querySelectorAll(a+"["+o+"]"),t.length)for(var i=0;t.length>i;i++)t[i].innerHTML=e[c],t[i].style.backgroundImage="none",t[i].removeAttribute(o);return t},u=function(t){"svg"===e.method&&o(function(){i(c(a(e.href))),"function"==typeof t&&t()})};e.embedIcons=i,e.getCSS=a,e.getIcons=c,e.ready=o,e.svgLoadedCallback=u,e.embedSVG=u})(grunticon,this);
                
                grunticon(["/theme/css/icons.data.svg.css", "/theme/css/icons.data.png.css", "/theme/css/icons.fallback.css"]);
            </script>
        <noscript><link href="/theme/css/icons.fallback.css" rel="stylesheet"></noscript>
        <!-- menu toggle javascript -->
        <script type="text/javascript">
            document.addEventListener("DOMContentLoaded", initMenu);
            
            function initMenu(){
                var menu = document.getElementById("menu");
                var menulink = document.getElementById("menu-link");
                menulink.addEventListener("click", function toggleMenu(){
                        window.event.preventDefault();
                        menulink.classList.toggle('active');
                        menu.classList.toggle('active');              
                    });
            };
        </script>
        <!-- 不蒜子 -->
        <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
</head>
<body>
    <div role="banner" id="masthead">
        <header>
            <a href="/"><img src="/images/mowang.png" alt="McManus Logo"></a>
                <h1>来玩魔王的咚@骑士救兵</h1>
            <a href="#menu" id="menu-link">more stuff</a>
            <nav id="menu">
                <ul>
                        <li><a href="/tags">tags</a></li>
                            <li><a href="/category/cloud.html">Cloud</a></li>
                            <li><a href="/category/docker.html">Docker</a></li>
                            <li><a href="/category/go.html">Go</a></li>
                            <li><a href="/category/linux.html">Linux</a></li>
                            <li><a href="/category/python.html">Python</a></li>
                            <li><a href="/category/xue-xi-bi-ji.html">学习笔记</a></li>
                            <li><a href="/category/yun-wei-zi-dong-hua.html">运维自动化</a></li>
                </ul>
            </nav>
        </header>
    </div>
        <div class="page" role="main">
<div class="articles">
<p class="paginator">
        <a href="/index4.html" class="previous">&laquo;</a>
    <span>
        <a href="/index.html">首页</a>
        &nbsp;5 / 9&nbsp;
        <a href="/index9.html">尾页</a>
    </span>
        <a href="/index6.html" class="next">&raquo;</a>
</p>
    <ol>
        <li>
            <article>
                <footer>
                        <p>
                        <time datetime="2020-09-15 12:00:00+08:00">
                            <script>document.write(moment('2020-09-15 12:00:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                        ~
                        <time datetime="2020-09-15 12:00:00+08:00">
                            <script>document.write(moment('2020-09-15 16:00:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                                in <a href="/category/python.html"><span class="category-tag">Python</span></a>
                    </p>
                </footer>
                <header>
                    <a href="/python-exception-handling.html">
                        <h2>异常处理</h2>
                    </a>
                </header>
                <div class="summary"><p>异常处理(try)：万能异常捕获；主动抛出异常(raise)：自定义异常，内置异常类型；断言(assert);traceback模块:将异常信息保存到文件</p> </div>
                <div class="tags">
                    <ul class="tags">
                        <li><a href="/tag/yi-chang-chu-li.html" class="tag">异常处理</a></li>
                    </ul>
                </div>
                <a href="/python-exception-handling.html">
                    <p class="readmore">Read more...</p>
                </a>
            </article>
        </li>
        <li>
            <article>
                <footer>
                        <p>
                        <time datetime="2020-09-14 15:00:00+08:00">
                            <script>document.write(moment('2020-09-14 15:00:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                        ~
                        <time datetime="2020-09-14 15:00:00+08:00">
                            <script>document.write(moment('2020-09-14 15:00:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                                in <a href="/category/linux.html"><span class="category-tag">Linux</span></a>
                    </p>
                </footer>
                <header>
                    <a href="/shell-command-line-parameters-getopt-and-getopts.html">
                        <h2>shell 命令行参数（getopt和getopts）</h2>
                    </a>
                </header>
                <div class="summary"><p>getopt命令：在命令行中使用，支持长选项，指定错误报告的程序名，可选参数；脚本中使用getopt：set命令，eval命令，解决参数空格问题，参数解析错误并退出；getopts命令：错误报告模式，示例代码；将选项标准化</p> </div>
                <div class="tags">
                    <ul class="tags">
                        <li><a href="/tag/shell.html" class="tag">shell</a></li>
                        <li><a href="/tag/ming-ling-xing-can-shu.html" class="tag">命令行参数</a></li>
                    </ul>
                </div>
                <a href="/shell-command-line-parameters-getopt-and-getopts.html">
                    <p class="readmore">Read more...</p>
                </a>
            </article>
        </li>
        <li>
            <article>
                <footer>
                        <p>
                        <time datetime="2020-09-02 15:00:00+08:00">
                            <script>document.write(moment('2020-09-02 15:00:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                        ~
                        <time datetime="2020-09-02 15:00:00+08:00">
                            <script>document.write(moment('2020-09-02 15:00:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                                in <a href="/category/linux.html"><span class="category-tag">Linux</span></a>
                    </p>
                </footer>
                <header>
                    <a href="/shell-command-line-parameters-basic.html">
                        <h2>shell 命令行参数（基本）</h2>
                    </a>
                </header>
                <div class="summary"><p>命令行参数：位置参数，脚本名，测试参数，获取所有参数；移动变量shift：使用示例，移动多个位置；处理选项：case配合shift，数组带空格的问题，分离参数和选项</p> </div>
                <div class="tags">
                    <ul class="tags">
                        <li><a href="/tag/shell.html" class="tag">shell</a></li>
                        <li><a href="/tag/ming-ling-xing-can-shu.html" class="tag">命令行参数</a></li>
                    </ul>
                </div>
                <a href="/shell-command-line-parameters-basic.html">
                    <p class="readmore">Read more...</p>
                </a>
            </article>
        </li>
        <li>
            <article>
                <footer>
                        <p>
                        <time datetime="2020-08-25 13:00:00+08:00">
                            <script>document.write(moment('2020-08-25 13:00:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                        ~
                        <time datetime="2020-08-25 13:00:00+08:00">
                            <script>document.write(moment('2020-08-27 15:00:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                                in <a href="/category/python.html"><span class="category-tag">Python</span></a>
                    </p>
                </footer>
                <header>
                    <a href="/python-moudle-functools.html">
                        <h2>Python functools 模块</h2>
                    </a>
                </header>
                <div class="summary"><p>reduce、map和filter，归约函数；wraps保留被装饰函数属性；partial冻结参数；lru_cache函数记忆；singledispatch单分派泛函数；一个能接收可选参数的装饰器：仅限关键字参数，run_time装饰器</p> </div>
                <div class="tags">
                    <ul class="tags">
                        <li><a href="/tag/zhuang-shi-qi.html" class="tag">装饰器</a></li>
                        <li><a href="/tag/pythonmo-kuai.html" class="tag">python模块</a></li>
                    </ul>
                </div>
                <a href="/python-moudle-functools.html">
                    <p class="readmore">Read more...</p>
                </a>
            </article>
        </li>
        <li>
            <article>
                <footer>
                        <p>
                        <time datetime="2020-08-20 16:00:00+08:00">
                            <script>document.write(moment('2020-08-20 16:00:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                        ~
                        <time datetime="2020-08-20 16:00:00+08:00">
                            <script>document.write(moment('2020-08-20 16:00:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                                in <a href="/category/go.html"><span class="category-tag">Go</span></a>
                    </p>
                </footer>
                <header>
                    <a href="/gopl-calling-c-code-with-cgo.html">
                        <h2>使用 cgo 调用 C 代码</h2>
                    </a>
                </header>
                <div class="summary"><p>用cgo调用C代码：使用cgo的场景，C代码，cgo注释，自定义bzip包；总结；安装cgo环境：Windows平台安装gcc，错误信息，下载安装，设置环境变量，运行一个简单cgo程序</p> </div>
                <div class="tags">
                    <ul class="tags">
                        <li><a href="/tag/gopl.html" class="tag">gopl</a></li>
                        <li><a href="/tag/cgo.html" class="tag">cgo</a></li>
                    </ul>
                </div>
                <a href="/gopl-calling-c-code-with-cgo.html">
                    <p class="readmore">Read more...</p>
                </a>
            </article>
        </li>
        <li>
            <article>
                <footer>
                        <p>
                        <time datetime="2020-08-19 12:40:00+08:00">
                            <script>document.write(moment('2020-08-19 12:40:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                        ~
                        <time datetime="2020-08-19 12:40:00+08:00">
                            <script>document.write(moment('2020-08-19 15:00:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                                in <a href="/category/linux.html"><span class="category-tag">Linux</span></a>
                    </p>
                </footer>
                <header>
                    <a href="/mysql-user-and-grant.html">
                        <h2>mysql用户权限</h2>
                    </a>
                </header>
                <div class="summary"><p>初始化：mariadb安全加固策略，mysql初始密码设置；查询用户的权限；用户密码设置；数据库权限修改</p> </div>
                <div class="tags">
                    <ul class="tags">
                        <li><a href="/tag/mysql.html" class="tag">mysql</a></li>
                    </ul>
                </div>
                <a href="/mysql-user-and-grant.html">
                    <p class="readmore">Read more...</p>
                </a>
            </article>
        </li>
        <li>
            <article>
                <footer>
                        <p>
                        <time datetime="2020-08-18 14:00:00+08:00">
                            <script>document.write(moment('2020-08-18 14:00:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                        ~
                        <time datetime="2020-08-18 14:00:00+08:00">
                            <script>document.write(moment('2020-08-18 14:00:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                                in <a href="/category/go.html"><span class="category-tag">Go</span></a>
                    </p>
                </footer>
                <header>
                    <a href="/gopl-low-level-programming.html">
                        <h2>底层编程（unsafe包）</h2>
                    </a>
                </header>
                <div class="summary"><p>unsafe包：Sizeof、Alignof和Offsetof，结构体内存对齐；unsafe.Pointer：查看浮点类型的位模式，修改结构体成员的值，不要把uintptr类型赋值给临时变量，reflect包返回的uintptr；深度相等示例：DeepEqual的不足，函数实现，支持循环引用，测试验证；注意事项</p> </div>
                <div class="tags">
                    <ul class="tags">
                        <li><a href="/tag/gopl.html" class="tag">gopl</a></li>
                    </ul>
                </div>
                <a href="/gopl-low-level-programming.html">
                    <p class="readmore">Read more...</p>
                </a>
            </article>
        </li>
        <li>
            <article>
                <footer>
                        <p>
                        <time datetime="2020-08-16 15:10:00+08:00">
                            <script>document.write(moment('2020-08-16 15:10:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                        ~
                        <time datetime="2020-08-16 15:10:00+08:00">
                            <script>document.write(moment('2020-08-17 11:30:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                                in <a href="/category/linux.html"><span class="category-tag">Linux</span></a>
                    </p>
                </footer>
                <header>
                    <a href="/shell-script-advanced.html">
                        <h2>shell脚本编写技巧</h2>
                    </a>
                </header>
                <div class="summary"><p>set设置：编写可靠的脚本；readonly：限制变量只读；flock：限制脚本单例执行；意外退出时kill所有子进程；timeout：限制运行时间；exit：退出状态码；IFS变量：字段分隔符；tee：同时打印并记录到文件；cat：脚本中创建文件；永久重定向;mktemp：创建本地临时文件</p> </div>
                <div class="tags">
                    <ul class="tags">
                        <li><a href="/tag/shell.html" class="tag">shell</a></li>
                        <li><a href="/tag/jin-cheng-suo.html" class="tag">进程锁</a></li>
                    </ul>
                </div>
                <a href="/shell-script-advanced.html">
                    <p class="readmore">Read more...</p>
                </a>
            </article>
        </li>
        <li>
            <article>
                <footer>
                        <p>
                        <time datetime="2020-08-17 11:00:00+08:00">
                            <script>document.write(moment('2020-08-17 11:00:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                        ~
                        <time datetime="2020-08-17 11:00:00+08:00">
                            <script>document.write(moment('2020-08-17 11:00:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                                in <a href="/category/linux.html"><span class="category-tag">Linux</span></a>
                    </p>
                </footer>
                <header>
                    <a href="/lock-program-by-file.html">
                        <h2>限制脚本单例运行</h2>
                    </a>
                </header>
                <div class="summary"><p>锁文件：把文件系统的文件作为锁，获取到文件权限即获取到锁；flock命令：crontab中加锁，shell脚本中加锁，只能单例执行的shell脚本；自己编写python模块实现加锁。</p> </div>
                <div class="tags">
                    <ul class="tags">
                        <li><a href="/tag/shell.html" class="tag">shell</a></li>
                        <li><a href="/tag/python.html" class="tag">python</a></li>
                        <li><a href="/tag/jin-cheng-suo.html" class="tag">进程锁</a></li>
                    </ul>
                </div>
                <a href="/lock-program-by-file.html">
                    <p class="readmore">Read more...</p>
                </a>
            </article>
        </li>
        <li>
            <article>
                <footer>
                        <p>
                        <time datetime="2020-08-14 11:20:00+08:00">
                            <script>document.write(moment('2020-08-14 11:20:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                        ~
                        <time datetime="2020-08-14 11:20:00+08:00">
                            <script>document.write(moment('2020-08-14 11:20:00+08:00').format('YYYY-MM-DD'));</script>
                        </time>
                                in <a href="/category/go.html"><span class="category-tag">Go</span></a>
                    </p>
                </footer>
                <header>
                    <a href="/gopl-reflection-2.html">
                        <h2>反射2</h2>
                    </a>
                </header>
                <div class="summary"><p>使用reflect.Value来设置值：判断值可寻址的方法，设置值的方法，注意事项，判断值可修改的方法；解码 S 表达式：词法分析器，函数实现，封装解析器；访问结构体字段标签：http服务端解析请求参数并完成结构体字段填充；显示类型的方法；慎用反射的三个原因</p> </div>
                <div class="tags">
                    <ul class="tags">
                        <li><a href="/tag/gopl.html" class="tag">gopl</a></li>
                        <li><a href="/tag/fan-she.html" class="tag">反射</a></li>
                    </ul>
                </div>
                <a href="/gopl-reflection-2.html">
                    <p class="readmore">Read more...</p>
                </a>
            </article>
        </li>
    </ol>
<p class="paginator">
        <a href="/index4.html" class="previous">&laquo;</a>
    <span>
        <a href="/index.html">首页</a>
        &nbsp;5 / 9&nbsp;
        <a href="/index9.html">尾页</a>
    </span>
        <a href="/index6.html" class="next">&raquo;</a>
</p>
</div>                <footer>
                    <div class="icons">
                    </div>
                    <span id="busuanzi_container_page_pv" style="padding: 10px">本文阅读量<span id="busuanzi_value_page_pv"></span>次</span>
                    <span id="busuanzi_container_site_pv" style="padding: 10px">本站总访问量<span id="busuanzi_value_site_pv"></span>次</span>
                    <span id="busuanzi_container_site_uv" style="padding: 10px">本站总访客数<span id="busuanzi_value_site_uv"></span>人</span>
                    <p>© <script>document.write(moment().format('YYYY'));</script> 749B</p>
                </footer>
        </div>
</body>
</html>